<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa, bb
aa=Request.ServerVariables("LOGON_USER")
if aa<>"Reserve" THEN
response.clear
response.end
end if


if Request.Querystring("Sn")<>"R1" THEN
response.clear
response.end
end if
'end if

if isEmpty(Request.Querystring("AN") ) then
response.clear
response.end
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb="Indy"
if instr(1,aa, bb,1)=0 THEN
response.clear
response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node, Sum, PA, CN, DTA, Ph, Ma, Fr, At, Res, Result, Processed, R_id, ServerName,de
Node=request("Node")
if isEmpty(Node) then Node="_P"
Sum=request("Sum")
if isEmpty(Sum) then Sum="0"
Ma=request("Ma")
if isEmpty(Ma) then Ma="0"
PA=request("PA")
if isEmpty(PA) then PA=""
CN=request("CN")
if isEmpty(CN) then CN=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""
Ph=request("Ph")
if isEmpty(Ph) then Ph=""
De=request("De")
if isEmpty(De) then De=1
Fr=request("Fr")
if isEmpty(Fr) then Fr=""
At=request("At")
if isEmpty(At) then At=""
Processed=request("Pr")
if isEmpty(Processed) then Processed=0
ServerName=request("sn")
if isEmpty(ServerName) then ServerName="Copy"

Res=request("Res")
if isEmpty(Res) then Res=-1

Result=request("Result")
if isEmpty(Result) then Result=""

R_id=request("R_id")
if isEmpty(R_id) then R_id=0

	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatPaymentCopy"

	Cmd.Parameters.Append Cmd.CreateParameter("@AutomatNumber", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@Phone0", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Sum", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@Margin", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@PA", adVarChar, adParamInput,36)
	Cmd.Parameters.Append Cmd.CreateParameter("@DEMOPayment", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarChar, adParamInput,160)
	Cmd.Parameters.Append Cmd.CreateParameter("@Fr", adVarChar, adParamInput,2)
	Cmd.Parameters.Append Cmd.CreateParameter("@At", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@Server", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@R_id", adInteger, adParamInput,8)
	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Res0", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Result0", adVarChar, adParamInput,160)
	Cmd.Parameters.Append Cmd.CreateParameter("@Processed", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@id", adInteger, adParamOutput,8)
	Cmd("@AutomatNumber")=Request.Querystring("AN")
	Cmd("@Phone0")=Ph
	Cmd("@Sum")=Sum
	Cmd("@Margin")=Ma
	Cmd("@Code")=Request.Querystring("Cd")
	Cmd("@PA")=PA
	Cmd("@DEMOPayment")=De
	Cmd("@CN")=CN
	Cmd("@Fr")=Fr
	Cmd("@At")=At
	Cmd("@Server")=ServerName
	Cmd("@R_id")=R_id
	Cmd("@DTA")=DTA
	Cmd("@Res0")=Res
	Cmd("@Result0")=Result
	Cmd("@Processed")=Processed
	cmd.execute
	%>
<Result>
<%=Cmd("@id")%>
</Result>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
